package com.example.oa;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.*;

@WebListener
public class SessionListenerTest implements HttpSessionListener, HttpSessionAttributeListener {
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        System.out.println("请求 created"+se.getSession().getId());
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        System.out.println("结束 destroyed"+se.getSession().getId());
    }

    @Override
    public void attributeAdded(HttpSessionBindingEvent event) {
        System.out.println("attr added "+ event.getName()+"->"+event.getValue());


    }

    @Override
    public void attributeRemoved(HttpSessionBindingEvent event) {
        System.out.println("attr Removed "+ event.getName()+"->"+event.getValue());

    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent event) {
        System.out.println("attr Replaced "+ event.getName()+"->"+event.getValue());
    }
}
